package day01

import java.text.SimpleDateFormat
import java.util.Date

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

class A {
  val num = 10

  val env = new Array[Int](num)
}
class B extends A {
  override val num = 20

}

object testhha {
  def main(args: Array[String]): Unit = {

    val a1 = List[Int](1,2,3)
    val a2 = List[Int](10,20,30)
    val a3=a1.zip(a2)
    println(a3)

//    val b = new B()
//    println(b.env.toBuffer.size)
//    println(b.num)
//    val value1 = 1 to 5
//    val result =  value1 match{
//      case Seq(_,_*) => 1
//      case _ => "result"
//
//    }
//
//    val str = "http://android.learn.com/android/video.shtml,5"
//    val arr1: Array[String] = str.split("/")
//    println("arr = " + arr1.toBuffer)
//    println(arr1(0)+"//"+arr1(2))
//
//    val conf: SparkConf = new SparkConf().setAppName("ss").setMaster("local")
//    val sc = new SparkContext(conf)
//
//    val fm = new SimpleDateFormat("HH:mm:ss")
//    val rdd1: RDD[String] = sc.textFile("C://Users/fuhao/Desktop/a.txt")
//    val rdd2: RDD[(Int, Long, String)] = rdd1.map(x => {
//      val va: Array[String] = x.split("\t")
//      val id: Int = va(0).toInt
//      val time: String = va(1)
//      val date: Long = fm.parse(time).getTime
//      val url: String = va(2)
//      (id, date, url)
//    }).sortBy(_._1)
//
//    val rdd3: RDD[(Int, Long, String)] = rdd2.sortBy(x => MyOrder(x._1,x._2),true)
//    val rdd5: RDD[(Int, String, String)] = rdd3.map(x => {
//      val date: String = fm.format(new Date(x._2.toLong))
//      (x._1, date, x._3)
//    })
//    println(rdd5.collect().toBuffer)
//
//    val str1 = "12:09:11"
//    val str2 = "16:42:17"
//    //字符串转时间戳
//    val date1: Date = fm.parse(str1)
//    val aa = fm.format(date1)
//
//    val time: Long = date1.getTime
//    println(date1)
//    println("date= "+aa)



  }
}
case class MyOrder(id: Int, time: Long) extends Ordered[MyOrder] {
  override def compare(that: MyOrder): Int = {
    if (this.id != that.id)
      return this.id-that.id
    else
      return (this.time-that.time).toInt
  }
}